package com.ky.facescan.base;

import android.app.Application;
import android.speech.tts.TextToSpeech;


import java.util.Locale;

public class BaseApp extends Application {

    public static TextToSpeech textToSpeech;
    public static Application app;

    @Override
    public void onCreate() {
        super.onCreate();
        app = this;
        textToSpeech = new TextToSpeech(BaseApp.app, i -> {
            if (i == TextToSpeech.SUCCESS) {
                int result = textToSpeech.setLanguage(Locale.CHINA);
                if (result != TextToSpeech.LANG_COUNTRY_AVAILABLE && result != TextToSpeech.LANG_AVAILABLE) {

                } else {
                    textToSpeech.setPitch(1.0f);// 设置音调，值越大声音越尖（女生），值越小则变成男声,1.0是常规
                    textToSpeech.setSpeechRate(1.0f);
                }
            }
        });
        new FaceFrame(this).initFrame();
    }
}
